﻿package edu.chds.data.xml{	import edu.chds.data.Model;		import flash.events.*;	import flash.net.*;		public class TimelineReader extends Model	{		public var documents:XMLList;		public var currentDocument:XML;		public var currentTitle:String;		public var title:String;		public var description:String;				public function TimelineReader()		{				}		override protected function updateData():void {			currentDocument = documents[currentIndex];			totalItems = documents.length();			currentTitle = currentDocument.title;		}		override protected function dataLoaded(e:Event):void {			_loader.removeEventListener(Event.COMPLETE, dataLoaded);			processXML(new XML(e.target.data));			setCurrentIndex(currentIndex);
		}		public function processXML(NEW_xmlData:XML):void {			data = new XML(NEW_xmlData);			documents = data..item;			title = data.title;			description = data.description;			setCurrentIndex(currentIndex);						dispatchEvent(new Event(Event.COMPLETE));		}		override protected function ioError(e:IOErrorEvent):void {			_loader.removeEventListener(IOErrorEvent.IO_ERROR, ioError);
			trace("IOError");
		}	}}